﻿using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Web.Api.Server.Models
{
    [Table(Name = "goods")]
    public class Goods
    {
        [Column(Name = "id", IsIdentity = true)]
        public int Id { get; set; }

        [Column(Name = "name", StringLength = 255)]
        public string Name { get; set; }

        [Column(Name = "describe", StringLength = 255)]
        public string Describe { get; set; }

        /// <summary>
        /// 库存数量
        /// </summary>
        [Column(Name = "inventory")]
        public int Inventory { get; set; }

        [Column(Name = "price")]
        public decimal Price { get; set; }

        [Column(Name = "goods_category_id", IsNullable = true)]
        public int? GoodsCategoryId { get; set; }

        [Column(Name = "shop_id")]
        public int ShopId { get; set; }

        [Column(Name = "created_at", IsNullable = true)]
        public DateTime? CreatedAt { get; set; } = DateTime.Now;

        [Column(Name = "updated_at", IsNullable = true)]
        public DateTime? UpdatedAt { get; set; } = DateTime.Now;

        public ICollection<Image> Images { get; set; }
    }
}
